/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package controller;

import controller.service.CourseControllerService;
import java.util.List;
import model.dao.CourseDAO;
import model.dao.service.CourseDAOService;
import model.entities.Course;

/**
 *
 * @author K u Ku
 */
public class CourseController implements CourseControllerService {
    private static CourseController courseCtrl;
    CourseDAOService courseDaoService = CourseDAO.getInstance();
    
    public static CourseController getInstance(){
        if(courseCtrl == null){
            courseCtrl = new CourseController();
        }
        return courseCtrl;
    }
    
    @Override
    public List<Course> getCourseList() {
        return courseDaoService.getCourseList();
    }

    @Override
    public Course getCourseByID(int CourseID) {
        return courseDaoService.getCourseByID(CourseID);
    }
    
    @Override
    public boolean insertCourse(Course course) {
        return courseDaoService.insertCourse(course);
    }
    
    @Override
    public boolean updateCourse(model.entities.Course course){
        return courseDaoService.updateCourse(course);
    }
    
    @Override
    public boolean deleteCourse(int courseID){
        return courseDaoService.deleteCourse(courseID);
    }    

    @Override
    public List<Course> findByID(int id) {
        return courseDaoService.findByID(id);
    }

    @Override
    public List<Course> findByName(String name) {
        return courseDaoService.findByName(name);
    }

    @Override
    public List<Course> getCourseByTeacherID(int teacherID) {
        return courseDaoService.getCourseByTeacherID(teacherID);
    }
}
